feat: preserve attribution source in fastgpt_sem#7304
Open
c121914yu wants to merge 1 commit into
Open
Conversation
Coverage Report
File CoverageNo changed files found. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends FastGPT’s marketing attribution tracking to accept a CRM-compatible source object (in addition to the legacy string fastgpt_source), persist it into fastgpt_sem.source, and reuse UTM fields from that object when explicit UTM query params are absent.
Changes:
- Added a
FastGPTSourceSchemaand widenedfastgpt_sem.sourcetostring | objectfor backward compatibility. - Implemented
parseFastGPTSourceto safely parse/validate thesourcequery param as a structured attribution object. - Updated app initialization to merge
source+ legacyfastgpt_sourceand to fall back to source-provided UTM values.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| projects/app/test/web/support/marketing/utils.test.ts | Adds unit tests for parsing valid/invalid source attribution payloads. |
| projects/app/src/web/support/marketing/utils.ts | Introduces parseFastGPTSource using Zod validation to safely parse the source param. |
| projects/app/src/web/context/useInitApp.ts | Reads source from the URL, reuses UTM values from it, and persists fastgpt_sem.source as object-or-string. |
| packages/global/support/marketing/type.ts | Adds FastGPTSourceSchema and updates FastGPT_SEM_Schema.source to accept either legacy strings or the new attribution object. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
✅ Admin Preview Image Ready! 🕒 Time: 2026-07-14 21:08:03 (UTC+8) |
|
✅ Build Successful - Preview fastgpt Image for this PR: 🕒 Time: 2026-07-14 21:10:06 (UTC+8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Accept and parse the CRM-compatible source object, persist it in fastgpt_sem.source, preserve legacy string sources and CTA fastgpt_source values, and reuse UTM values from the source object. Targeted marketing tests 4 passed and global tests 1670 passed. Full app typecheck is blocked by the upstream missing src/assets/skill/runtimeUpgradeModalBg.jpg file.